package com.eastedu.service.impl;

import com.eastedu.repository.permission.mapper.PermissionContentMapper;
import com.eastedu.repository.permission.po.PermissionContentPO;
import com.eastedu.service.AbstractPermissionDataSourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 〈〉
 *
 * @author ZHISHUAI.ZHANG
 * @since 2021 /7/28
 */
@Slf4j
@Service("permission-content-source")
public class PermissionDataSourceServiceImpl extends AbstractPermissionDataSourceService<PermissionContentPO> {

    /**
     * Instantiates a new Permission data source service.
     *
     * @param permissionContentMapper the permission content mapper
     */
    public PermissionDataSourceServiceImpl(PermissionContentMapper permissionContentMapper) {
        super(permissionContentMapper);
        /// super.addScriptByTableName("permission_content");
        super.addScript("UPDATE permission_content t1 SET t1.sync_state = 0");
    }

    @Override
    protected void setContent(PermissionContentPO po, String jsonContent) {
        po.setContent(jsonContent);
    }

    @Override
    protected String getContent(PermissionContentPO po) {
        return po.getContent();
    }
}